package com.red.wood.module.eval.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.red.wood.module.eval.dao.TaskFlowDao;
import com.red.wood.module.eval.service.TaskFlowService;

@Service
@Transactional
public class TaskFlowServiceImpl implements TaskFlowService{
	
	@Autowired
	private TaskFlowDao taskFlowDao;
	
	@Override
	public void add(Map<String, Object> paramMap) {
		taskFlowDao.add(paramMap);
	}

	@Override
	public List<Map<String, Object>> getBySingleTaskId(String singleTaskId) {
		return taskFlowDao.getBySingleTaskId(singleTaskId);
	}

	@Override
	public List<Map<String, Object>> getBySingleTaskIdAndStatue(
			String singleTaskId, String statue) {
		return taskFlowDao.getBySingleTaskIdAndStatue(singleTaskId, statue);
	}

	@Override
	public void insertHistoryWorkOrder(Map<String, Object> params) {
		taskFlowDao.insertHistoryWorkOrder(params);
	}

	@Override
	public Map<String, Object> getHistoryWorkOrderInfo(String singleTaskId) {
		Map<String,Object> map = new HashMap<String,Object>();
		List<Map<String,Object>> list = taskFlowDao.getHistoryWorkOrderInfo(singleTaskId);
		if(list != null && list.size() > 0) {
			map = list.get(0);
		}
		return map;
	}

	@Override
	public boolean getHistoryWorkOrderByFormNumber(String formNumber) {
		boolean exists = false;
		List<Map<String,Object>> list = taskFlowDao.getHistoryWorkOrderByFormNumber(formNumber);
		if(list != null && list.size() > 0) {
			exists = true;
		}
		return exists;
	}

	@Override
	public void updateHistoryWorkOrder(Map<String, Object> params, String queryConf) {
		taskFlowDao.updateHistoryWorkOrder(params, queryConf);
	}
}
